version: '3.8'
services:
  ewm-service:
    build: main-service
    image: ewm-service
    container_name: ewm-service
    ports:
      - "8080:8080"
    depends_on:
      - ewm-db
    environment:
      - SPRING_DATASOURCE_URL=jdbc:postgresql://ewm-db:5432/ewm
      - POSTGRES_USER=login
      - POSTGRES_PASSWORD=password

  ewm-db:
     image: postgres:13.7-alpine
     container_name: ewm-db
     ports:
      - "6540:5432"
     environment:
      - POSTGRES_DB=ewm
      - POSTGRES_USER=login
      - POSTGRES_PASSWORD=password

  stats-server:
    build: stats/stats-server
    image: stats-server
    container_name: stats-server
    ports:
      - "9090:9090"
    depends_on:
      - stats-db
    environment:
      - SPRING_DATASOURCE_URL=jdbc:postgresql://stats-db:5432/stats
      - POSTGRES_USER=login
      - POSTGRES_PASSWORD=password

  stats-db:
    image: postgres:13.7-alpine
    container_name: stats-db
    ports:
      - "6541:5432"
    environment:
      - POSTGRES_DB=stats
      - POSTGRES_USER=login
      - POSTGRES_PASSWORD=password